<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/asserts/backstage/bootrap-table/fresh-bootstrap-table.css" />
	<title>商品分类管理</title>
</head>
<body>
<jsp:include page="../frame.jsp" />
<div class="main-content">
	<div class="main-content-inner">
		<div class="breadcrumbs ace-save-state" id="breadcrumbs">
			<ul class="breadcrumb">
				<li>
					<i class="ace-icon fa fa-home home-icon"></i>
					<a href="${pageContext.request.contextPath}/statistics">首页</a>
				</li>
				<li class="active">商品分类管理</li>
			</ul><!-- /.breadcrumb -->
		</div>

		<div class="page-content">
			<div class="page-header">
				<h1>
					商品分类管理
					<small>
						<i class="ace-icon fa fa-angle-double-right"></i>
						商品分类列表
					</small>
				</h1>
			</div><!-- /.page-header -->

			<div class="row">
				<div class="col-xs-12 col-sm-12">
					<!-- PAGE CONTENT BEGINS -->
					<div class="row">
						<div class="col-xs-12">
							<div class="clearfix">
								<c:if test="${not empty searchsize}">
									<div class="pull-left tableTools-container">找到${searchsize}条记录</div>
								</c:if>
							</div>
							<div class="table-header">
								商品分类详情列表
							</div>

							<div class="col-xs-12">
								<h3>${msg}</h3>
								<div class="fresh-table tab-content table-responsive">

									<div id="toolbar">
									</div>

									<table id="fresh-table" class="table table-striped table-bordered table-hover">
									</table>
								</div>
							</div>
						</div>
					</div>
					<!-- PAGE CONTENT ENDS -->
				</div><!-- /.col -->
			</div><!-- /.row -->
			<!-- PAGE CONTENT ENDS -->
		</div>
	</div>
</div>
</body>
<script type="text/javascript" src="${pageContext.request.contextPath}/asserts/backstage/bootrap-table/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/asserts/backstage/bootrap-table/bootstrap-table.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/asserts/backstage/bootrap-table/bootstrap-table-zh-CN.js"></script>
<script type="text/javascript">
	var $table = $('#fresh-table');
	$().ready(function(){
		$table.bootstrapTable({
			url : '${pageContext.request.contextPath}/categoryManage?method=getAllCategory',
			method : 'POST',
			toolbar : "#toolbar",
			search : true,
			searchAlign : 'left',
			showRefresh : true,
			showHeader : true,
			showToggle : true,
			showColumns : true,
			buttonsAlign : 'right',
			pagination: true,
			striped: true,
			pageSize: 5,
			pageList: [5,10,25,50,100],
			columns : [{
				field : 'cid',
				title : '分类id',
				align: 'center',
				valign: 'middle',
				class:'hidden-480',
				sortable : true
			}, {
				field : 'cname',
				title : '商品分类',
				align: 'center',
				valign: 'middle',
				sortable : true
			}, {
				field : 'cid',
				title : '操作',
				formatter : operateFormatter
			} ],
			silent : true,
			formatNoMatches : function () {
				return '没有符合条件的记录';
			}
		});


		// 判断是手机访问
		if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
			// 修改样式
			$('.search').css({"width":"100%"});
			$('.columns').css({"padding-right":"15%"});

		}

	});

	/*$(window).resize(function () {
		var windowWidth = $(window).width();
		var search = $('.search').css("width");
		var column = $('.columns').css("padding-right");
		if(windowWidth < 700){
			$('.search').css({"width":"100%"});
			$('.columns').css({"padding-right":"15%"});
		}else{
			$('.search').css({"width":search});
			$('.columns').css({"padding-right":column});
		}
	});*/

	function operateFormatter(value, row, index) {
		return [
			'<div class="hidden-sm hidden-xs action-buttons">\n' +
			'                                                        <a class="blue" href="${pageContext.request.contextPath}/categoryManage?method=editCategoryPage" title="添加">\n' +
			'                                                            <i class="ace-icon fa fa-plus bigger-130"></i>\n' +
			'                                                        </a>\n' +
			'\n' +
			'                                                        <a class="green" href="${pageContext.request.contextPath}/categoryManage?method=editCategoryPage&cid='+value+'" title="编辑">\n' +
			'                                                            <i class="ace-icon fa fa-pencil bigger-130"></i>\n' +
			'                                                        </a>\n' +
			'\n' +
			'                                                        <a class="red" href="${pageContext.request.contextPath}/categoryManage?method=deleteCategory&cid='+value+'" title="删除">\n' +
			'                                                            <i class="ace-icon fa fa-trash-o bigger-130"></i>\n' +
			'                                                        </a>\n' +
			'                                                    </div>\n' +
			'\n' +
			'                                                    <div class="hidden-md hidden-lg">\n' +
			'                                                        <div class="inline pos-rel">\n' +
			'                                                            <button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">\n' +
			'                                                                <i class="ace-icon fa fa-caret-down icon-only bigger-120"></i>\n' +
			'                                                            </button>\n' +
			'\n' +
			'                                                            <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">\n' +
			'                                                                <li>\n' +
			'                                                                    <a href="${pageContext.request.contextPath}/categoryManage?method=editCategoryPage" class="tooltip-info" data-rel="tooltip" title="添加">\n' +
			'                                                                        <span class="blue">\n' +
			'                                                                            <i class="ace-icon fa fa-plus bigger-120"></i>\n' +
			'                                                                        </span>\n' +
			'                                                                    </a>\n' +
			'                                                                </li>\n' +
			'\n' +
			'                                                                <li>\n' +
			'                                                                    <a href="${pageContext.request.contextPath}/categoryManage?method=editCategoryPage&cid='+value+'" class="tooltip-success" data-rel="tooltip" title="编辑">\n' +
			'                                                                        <span class="green">\n' +
			'                                                                            <i class="ace-icon fa fa-pencil-square-o bigger-120"></i>\n' +
			'                                                                        </span>\n' +
			'                                                                    </a>\n' +
			'                                                                </li>\n' +
			'\n' +
			'                                                                <li>\n' +
			'                                                                    <a href="${pageContext.request.contextPath}/categoryManage?method=deleteCategory&cid='+value+'" class="tooltip-error" data-rel="tooltip" title="删除">\n' +
			'                                                                    <span class="red">\n' +
			'                                                                        <i class="ace-icon fa fa-trash-o bigger-120"></i>\n' +
			'                                                                    </span>\n' +
			'                                                                    </a>\n' +
			'                                                                </li>\n' +
			'                                                            </ul>\n' +
			'                                                        </div>\n' +
			'                                                    </div>'
		].join('');
	}

</script>
</html>